<template>
  <div class="ibk">
    <div @click="downloadTmpl">
      <slot>
        <a-button :disabled="disabled" :size="size">
          <i class="fa fa-download mr5"></i>下载模板
        </a-button>
      </slot>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    disabled: {
      type: Boolean,
      default: false
    },
    size: {
      type: String,
      default: 'default'
    },
    fileName: {
      type: String,
      default: ''
    }
  },
  data () {
    return {
    }
  },
  methods: {
    downloadTmpl () {
      if (!this.fileName || this.fileName.length === 0) {
        this.$warning({ title: '请设置模板文件' })
        return
      }
      this.$http.download('/zg-system/tmpl/download', {
        fileName: this.fileName
      }, this.fileName)
    }
  }
}
</script>
<style lang="less" scoped>
</style>
